package com.lz.autotest.project.websocketApi.netty.post;

import com.lz.autotest.project.websocketApi.netty.store.ChannelStore;
import io.netty.channel.Channel;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
import io.netty.util.AttributeKey;

public class pusher {

    public static void sendOneMsg(String ip,String msg){
        for (Channel channel : ChannelStore.CHANNEL_GROUP) {
            String clientIp = String.valueOf(channel.attr(AttributeKey.valueOf("IP")));
            if (clientIp.equals(ip)){
                channel.writeAndFlush(new TextWebSocketFrame(msg));
            }
        }
    }
}
